//
//  UIButton+Extension.swift
//  weibo
//
//  Created by 李言 on 16/6/2.
//  Copyright © 2016年 ly. All rights reserved.
//

import UIKit

extension UIButton {

    convenience init(ImageNamed: String, BackgroundImageName: String){
        self.init()
        setImage(UIImage(named: ImageNamed), forState: UIControlState.Normal)
        setImage(UIImage(named: ImageNamed + "_highlighted"), forState: UIControlState.Highlighted)
        setBackgroundImage(UIImage(named: BackgroundImageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: BackgroundImageName + "_highlighted"), forState: UIControlState.Highlighted)

        sizeToFit()
    }

    convenience init(title: String, backImageName: String, titleColoe: UIColor = UIColor.darkGrayColor()){
        self.init()
        setBackgroundImage(UIImage(named: backImageName), forState: UIControlState.Normal)
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(titleColoe, forState: UIControlState.Normal)
    }
}
